package com.xzl.xep.web.interseptor;

import org.apache.commons.configuration.PropertiesConfiguration;



public class Config {
	//配置文件的文件名，配置文件位于$BASE/conf下
	

	private static PropertiesConfiguration config = null;

	
	public static void init(String config_filename) throws Exception{
		String absolutePath = Config.class.getResource(config_filename).getFile();
		config = new PropertiesConfiguration(absolutePath);
			
	}

	public static String getString(String key, String defaultValue) {
		return config.getString(key, defaultValue);
	}

	public static String getString(String key) {
		return config.getString(key, null);
	}

	public static int getInt(String key, int defaultValue) {
		return config.getInt(key, defaultValue);
	}

	public static int getInt(String key) {
		return config.getInt(key, 0);
	}
	
	public static long getLong(String key, long defaultValue) {
		return config.getLong(key, defaultValue);
	}

	public static long getLong(String key) {
		return config.getLong(key, 0);
	}

	public static String[] getStringArray(String key) {
		return config.getStringArray(key);
	}

	public static boolean getBoolean(String key, boolean defaultValue) {
		return config.getBoolean(key, defaultValue);
	}

	public static boolean getBoolean(String key) {
		return config.getBoolean(key, false);
	}

	public static float getFloat(String key, float defaultValue) {
		return config.getFloat(key, defaultValue);
	}

	public static float getFloat(String key) {
		return config.getFloat(key, 0);
	}
	
}
